//
//  BaseViewController.m
//  LiquorChain
//
//  Created by apple on 2018/12/24.
//  Copyright © 2018年 王冬. All rights reserved.
//

#import "BaseViewController.h"
#import <RTRootNavigationController.h>
@interface BaseViewController ()

@end

@implementation BaseViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    
    [self setupLeftBarButton];
}

//- (UIBarButtonItem *)rt_customBackItemWithTarget:(id)target action:(SEL)action{
//    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
//    [btn setImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal];
//    [btn sizeToFit];
//    [btn addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
//    return [[UIBarButtonItem alloc] initWithCustomView:btn];
//}


- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    //self.navigationController.navigationBar.barTintColor = [UIColor whiteColor];

}

#pragma mark - 自定义返回按钮
- (void)setupLeftBarButton {
    
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]
                                             initWithImage:[[UIImage imageNamed:@"back"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]
                                             style:UIBarButtonItemStyleDone
                                             target:self
                                             action:@selector(leftBarButtonClick)];
    // 防止返回手势失效
    self.navigationController.interactivePopGestureRecognizer.delegate = (id<UIGestureRecognizerDelegate>)self;
}

#pragma mark - 返回按钮的点击事件
- (void)leftBarButtonClick {
    [self.navigationController popViewControllerAnimated:YES];
}






@end
